import Vue from 'vue'
import Vuex from 'vuex'

import commonStore from './commonStore'

// 合并views 下全部 store 文件

// import modules from './modules'

let modules = {};
const files = require.context('../views', true, /store\.js$/)
files.keys().forEach(key => {
  // console.log(key);
  // if (key === './index.js') return
  var _key = key.replace(/(\.\/|\/store\.js)/g, '').replace(/\/module\//g, '-')
  modules[_key] = files(key).default
})
modules.commonStore = modules;

Vue.use(Vuex);
export default new Vuex.Store({
  modules,
  plugins: [],
  strict: false
})
